package com.ruoyi.web.controller.teaching;


import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.teaching.domain.PlatformTScore;
import com.ruoyi.teaching.service.PlatformTScoreService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author 王旭
 * @since 2024-06-18
 */
@RestController
@RequestMapping("/platform/taskScore")
@Api(tags = "platform-作业成绩管理")
public class PlatformTScoreController {
    @Autowired
    private PlatformTScoreService platformTScoreService;

    /**
     * 老师查询作业成绩列表
     */
//    @PreAuthorize("@ss.hasPermi('platform:score:listTeacher')")
    @GetMapping("/listTeacher")
    @ApiOperation(value = "老师查询作业成绩列表", notes = "老师查询作业成绩列表")
    public AjaxResult listTeacher(
            Integer pageNum, Integer pageSize, String examName, Integer taskStatus,
            Integer vettingStatus, Integer deptId, Integer studentId
    )
    {
        return platformTScoreService.selectPlatformTScoreListTeacher(
                pageNum, pageSize, examName, taskStatus, vettingStatus, deptId, studentId
        );
    }

    /**
     * 学生查询作业成绩列表
     */
//    @PreAuthorize("@ss.hasPermi('platform:score:listStudent')")
    @GetMapping("/listStudent")
    @ApiOperation(value = "学生查询作业成绩列表", notes = "学生查询作业成绩列表")
    public AjaxResult listStudent(
            Integer pageNum, Integer pageSize, Integer courseId, Integer vettingStatusAndIsClose,String taskName
    )
    {
        return platformTScoreService.selectPlatformTScoreListStudent(
                pageNum, pageSize, courseId, vettingStatusAndIsClose, taskName
        );
    }

    /**
     * 查询作业成绩详细信息
     */
//    @PreAuthorize("@ss.hasPermi('platform:score:query')")
    @GetMapping(value = "/{id}")
    @ApiOperation(value = "查询作业成绩详细信息", notes = "查询作业成绩详细信息")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return platformTScoreService.selectPlatformTScoreById(id);
    }

//    /**
//     * 新增【请填写功能名称】
//     */
//    @PreAuthorize("@ss.hasPermi('platform:score:add')")
//    @Log(title = "【请填写功能名称】", businessType = BusinessType.INSERT)
//    @PostMapping
//    public AjaxResult add(@RequestBody PlatformTScore platformTScore)
//    {
//        return toAjax(platformTScoreService.insertPlatformTScore(platformTScore));
//    }

    /**
     * 修改作业成绩信息
     */
//    @PreAuthorize("@ss.hasPermi('platform:score:edit')")
    @Log(title = "【修改作业成绩信息】", businessType = BusinessType.UPDATE)
    @ApiOperation(value = "修改作业成绩信息", notes = "修改作业成绩信息")
    @PutMapping
    public AjaxResult edit(@RequestBody PlatformTScore platformTScore)
    {
        return platformTScoreService.updatePlatformTScore(platformTScore);
    }

    /**
     * 删除作业成绩信息
     */
//    @PreAuthorize("@ss.hasPermi('platform:score:remove')")
    @Log(title = "【删除作业成绩信息】", businessType = BusinessType.DELETE)
    @ApiOperation(value = "删除作业成绩信息", notes = "删除作业成绩信息")
    @DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return platformTScoreService.deletePlatformTScoreByIds(ids);
    }
}

